package cn.jhc.factory;

import cn.jhc.dao.AccountDAO;
import cn.jhc.dao.AuthorDAO;
import cn.jhc.dao.AuthorIsbnDAO;
import cn.jhc.dao.BookOrderDAO;
import cn.jhc.dao.DaoType;
import cn.jhc.dao.PublisherDAO;
import cn.jhc.dao.RoleDAO;
import cn.jhc.dao.RoleRightDAO;
import cn.jhc.dao.TitleDAO;
import cn.jhc.dao.UserDao;

public class DAOFactory {

	private static TitleDAO titleDAO = new TitleDAO();
	private static BookOrderDAO bookOrderDAO = new BookOrderDAO();
	private static AuthorDAO authorDAO = new AuthorDAO();
	private static UserDao userDao = new UserDao();
	private static AccountDAO accountDao = new AccountDAO();
	private static PublisherDAO publisherDAO = new PublisherDAO();
	private static AuthorIsbnDAO authorIsbnDAO = new AuthorIsbnDAO();
	private static RoleDAO roleDAO = new RoleDAO();
	private static RoleRightDAO rightDAO = new RoleRightDAO();
	
	public static Object getDao(DaoType type) {
		switch(type) {
		case TITLE:
			return titleDAO;
		case AUTHOR:
			return authorDAO;
		case BOOKORDER:
			return bookOrderDAO;
		case USER:
			return userDao;
		case ACCOUNT:
			return accountDao;
		case PUBLISHER:
			return publisherDAO;
		case AUTHORISBN:
			return authorIsbnDAO;
		case ROLE:
			return roleDAO;
		case ROLERIGHT:
			return rightDAO;
			
		default:
			return null;
		}

	}
}
